package me.zhengjie.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.dao.FloorMinMaxDao;
import me.zhengjie.dao.OutboundOrder;
import me.zhengjie.server.impl.FloorMinMaxServiceImpl;
import me.zhengjie.vo.FloorMinMaxVo;
import me.zhengjie.vo.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RestController
@RequiredArgsConstructor
@Api(tags = "库区最小最大值管理")
@RequestMapping("/api/minMaxFloor")
public class MinMaxFloorController {

    private final FloorMinMaxServiceImpl floorMinMaxService;

    @Log("设置库区最小最大值")
    @ApiOperation("设置库区最小最大值")
    @PostMapping
    @Transactional
    public Result<Object> exportOutBoundOrder(@RequestBody List<FloorMinMaxDao> minMaxDaos) throws IOException {
        if (minMaxDaos != null) {
            floorMinMaxService.updateBatchById(minMaxDaos);
        }
        return Result.success(floorMinMaxService.selectList());
    }

}
